import { post } from '@/request/http'
import store from '@/store'

/**
 * 权限管理
 *  1. 角色列表查询 getAuthList
 */

export const getAuthList = data =>
  post(
    '/FTKJWLHYPT/platform/queryRoleAuth',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            FLT_UUID: store.state.user.FLT_UUID_DX_H,
            rleCUuid: data.rleCUuid
          }
        },
      }
    }
  )

export const getAuthMenu = data =>
  post(
    '/FTKJWLHYPT/platform/allModuleListByRole',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            uuid: data.ROLE_UUID,
            rleCUuid: data.rleCUuid
          }
        }
      }
    }
  )

export const saveAuth = data =>
  post(
    '/FTKJWLHYPT/platform/addRight',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rgtRoleId: data.ROLE_UUID,
            rgtMdlIdList: data.MENU
          }
        }
      }
    }
  )
